<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
	</body>
	<script>
		let data = {
			name:'华清远见',
			address:'重庆'
		}
		
		// 创建一个监视的实例对象，用于监视data中的属性变化
		const obs = new Observerr(data)
		
		console.log(obs)
		
		function Observerr(obj){
			const keys = Object.keys(obj)
			keys.forEach(k => {
				Object.defineProperty(this,k,{
					get(){
						return obj[k]
					},
					set(val){
						obj[k] = val
					}
				})
			})
		}
		
	</script>
</html>